var searchDefTxt = "Filter files ...";

function openUploadForm()
{
    $("#upform").slideDown();
    $("#upform").data('isVisible', "1");
}

function initExplorer(openUploader, fileMask)
{
    $("#msgdiv").hide();    // hiding message container
    $("#upform").hide();    // upload form
    $(".manager").hide();   // spans which contain the file functions
    
    document.getElementById('overwrite-ifexists').checked = true
    
    var search = $("#bm_menu li input"); 
    
    search
        .click
        (
            function ()
            {
                if ($(this).val() == searchDefTxt)
                {
                    $(this).val("");
                    $("#bm_menu li input").css('text-align', 'left');
                }
                else
                    $(this).select();
            }
        )
        .blur
        (
            function ()
            {
                if ($(this).val() == "")
                    {
                        $(this).val(searchDefTxt);    
                        $("#bm_menu li input")
                            .css('color', 'gray')
                            .css('text-align', 'center');
                    }
            }
        )
        .keydown
        (
            function(e)
            {
                $("#bm_menu li input")
                    .css('color', 'black')
                    .css('text-align', 'left');
                
                if (e.keyCode == 13)
                    pageRefresh(true);
            }
        ).val(fileMask ? fileMask : searchDefTxt);
        
    if (fileMask)
    {
        search.click();
        
        showCustomMsg("Currently applying '<b>" + fileMask + "</b>' file mask. <a href='javascript:pageRefresh(false)'>Remove mask</a>")
    }
    
    if (openUploader)   
        openUploadForm();
};